<!DOCTYPE html>
<!--suppress ALL-->
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta http-equiv="X-UA-Compatible" content="IE=Edge">
    <meta charset="UTF-8">
    <meta content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' name='viewport'>
    <!-- 最新版本的 Bootstrap 核心 CSS 文件 -->
    <link th:href="@{/bootstrap/bootstrap.min.css}" rel="stylesheet">
    <link rel="stylesheet" type="text/css" th:href="@{/css/jqTable.css}">
    <link rel="stylesheet" type="text/css" th:href="@{/page/page.css}">
    <style type="text/css">
        .pageTest {
            width: 70%;
            height: 50px;
            margin-top: 0%;
        }

        .activP {
            background-color: #367fa9 !important;
            color: #fff !important;
        }
    </style>
    <style>
        .p20 {
            padding: 20px;
        }

        .mt20 {
            margin-top: 20px;
        }

        .mr10 {
            margin-right: 10px;
        }

        .hide {
            display: none;
        }
    </style>
    <title>IP限制管理</title>
</head>
<body style="opacity: 0.85;padding-left:3%;padding-right: 3%;-webkit-background-size: 100%;background-repeat: no-repeat;background-size: cover;background-attachment: fixed;background-color: #f9f9f9">
<div style="margin-bottom: 1%;margin-top: 5%">
    <a class="btn btn-primary" href="/admin/admin/LockIPupdate/0" data-tag="Off">添加区域</a>
    <a class="btn btn-primary " href="javascript:;" data-tag="Off" onclick="del()">删除</a>
    <!--<a class="btn btn-primary " href="javascript:;" data-tag="Off" onclick="editor()">修改</a>-->
</div>
<div class="g-selectAll--main">
    <div class="c-table c-table--border">
        <table id="tab02" cellspacing="0" cellpadding="0" border="1" role="c-table">
            <thead>
            <tr>
                <th>
                    <b>选择</b>
                </th>
                <th class="">
                    <div class="cell">对应区域</div>
                </th>
                <th class="">
                    <div class="cell">起始IP</div>
                </th>
                <th class="">
                    <div class="cell">结束IP</div>
                </th>
                <th class="">
                    <div class="cell">权限范围</div>
                </th>
            </tr>
            </thead>
            <tbody>
            <tr th:each="lockIp:${lockIps}">
                <td>
                    <input type="checkbox" class="g-selectAll--input"/>
                    <p hidden="hidden" th:text="${lockIp.ipid}+'@'">
                    </p>
                </td>
                <td>
                    <a style="color: #0a6aa1" th:href="'/admin/admin/LockIPupdate/'+${lockIp.ipid}" th:text="${lockIp.areaname}"></a>
                </td>
                <td th:text="${lockIp.ip1}"></td>
                <td th:text="${lockIp.ip2}"></td>
                <td th:text="${lockIp.dbid}"></td>
            </tr>
            </tbody>
        </table>
    </div>
    <br>
</div>
</div>
</div>
<div th:unless="${count} eq '0'">
    <ul class="pager">
        <b th:if="${page} gt '1'">
            <li><a th:href="'/admin/admin/LockIPsget/'+'/1'"><<</a></li>
        </b>
        <b th:unless="${page} gt '1'">
            <li><a th:href="'/admin/admin/LockIPsget/'+${page}"><<</a></li>
        </b>
        <b th:if="${pageCount}>'5'">
            <li th:if="${page} gt '1'"><a th:href="'/admin/admin/LockIPsget/'+${prePage}" th:text="${prePage}"></a></li>
            <b th:if="${diffValue}>='5'">
                <li><a style="background-color: gainsboro" th:href="'/admin/admin/LockIPsget/'+${page}" th:text="${page}"></a></li>
                <li><a th:href="'/admin/admin/LockIPsget/'+${page+1}" th:text="${page+1}"></a></li>
                <li><a th:href="'/admin/admin/LockIPsget/'+${page+2}" th:text="${page+2}"></a></li>
                <li><a th:href="'/admin/admin/LockIPsget/'+${page+3}" th:text="${page+3}"></a></li>
                <li><a th:href="'/admin/admin/LockIPsget/'+${page+4}" th:text="${page+4}"></a></li>
                <li><a th:href="'/admin/admin/LockIPsget/'+${page+5}">>></a></li>
            </b>
            <b th:unless="${diffValue}>='5'">
                <b th:each="p:${#numbers.sequence(0,diffValue)}">
                    <b th:if="${page+p} le ${pageCount}">
                        <li th:if="${p} eq '0'"><a style="background-color: gainsboro" th:href="'/admin/admin/LockIPsget/'+${page+p}" th:text="${page+p}"></a>
                        </li>
                        <li th:unless="${p} eq '0'"><a th:href="'/admin/admin/LockIPsget/'+${page+p}" th:text="${page+p}"></a>
                        </li>
                    </b>
                </b>
                <li><a th:href="'/admin/admin/LockIPsget/'+${page+diffValue}">>></a></li>
            </b>
        </b>
        <b th:unless="${pageCount}>'5'">
            <li th:if="${page} gt '1'"><a th:href="'/admin/admin/LockIPsget/'+${prePage}" th:text="${prePage}"></a></li>
            <b th:each="p:${#numbers.sequence(0,pageCount)}">
                <b th:if="${page+p} le ${pageCount}">
                    <li th:if="${p} eq '0'"><a style="background-color: gainsboro" th:href="'/admin/admin/LockIPsget/'+${page+p}" th:text="${page+p}"></a>
                    </li>
                    <li th:unless="${p} eq '0'"><a th:href="'/admin/admin/LockIPsget/'+${page+p}" th:text="${page+p}"></a>
                    </li>
                </b>
            </b>
            <b th:unless="${pageCount}=='0'">
                <li><a th:href="'/admin/admin/LockIPsget/'+${pageCount}">>></a></li>
            </b>
            <b th:if="${pageCount}=='0'">
                <li><a th:href="'/admin/admin/LockIPsget/'+'/1'">>></a></li>
            </b>
        </b>
    </ul>
</div>

<script th:src="@{/js/jquery-1.11.3.min.js}"></script>
<script type="text/javascript" th:src="@{/page/page.js}"></script>

<!--开源模版引擎： art-template@4.12.2 for browser | https://github.com/aui/art-template  -->
<script th:src="@{/js/plugins/artTemplate.js}"></script>
<!--另一个插件，消息提示插件  -->
<script th:src="@{/js/plugins/message.js}"></script>
<!-- 必要插件：固定列滚动需要用到，鼠标滚动兼容多浏览器 -->
<script th:src="@{/js/jquery.mousewheel.min.js}"></script>
<!-- 总引入  -->
<script th:src="@{/js/zipJs/jqTable.all.min.js}"></script>

<!-- 也可分开引入  -->
<!-- <script src="pdfjs/jqTable.all.pdfjs"></script> -->
<!-- <script src="pdfjs/jqTablePlugins.pdfjs"></script>
<script src="pdfjs/jqTable.pdfjs"></script> -->
<!-- 临时用的json -->
<script th:src="@{/js/json.js}"></script>
<script type="text/javascript">
    function del() {
        if ($("input[type='checkbox']:checked").length > 0) {
            var str = $("input[type='checkbox']:checked").next().text();
            $.post("/admin/admin/LockIPsDelete", {
                str: str,
            }, function () {
                alert("删除成功")
                window.location.reload()
            });
        }
        if ($("input[type='checkbox']:checked").length == 0) {
            alert("请先选择")
        }
    };

    function editor() {
        if ($("input[type='checkbox']:checked").length > 1) {
            alert("一次只能选择一个")
        }
        if ($("input[type='checkbox']:checked").length < 1) {
            alert("请先选择")
        } else if ($("input[type='checkbox']:checked").length == 1) {
            var str = $("input[type='checkbox']:checked").next().text();
            window.location.replace('/admin/admin/userUpdate/'+str);
        }
    }
</script>
</body>
</html>
